﻿using System;
using System.Configuration;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
using BadmintonApp.DAO.Interface;

namespace BadmintonApp.Factory
{
    public class DaoFactory
    {
        private static readonly string path = ConfigurationManager.AppSettings["DAOImpl"];

        private DaoFactory() { }

        public static IActivityDAO CreateActivityDAO()
        {
            string className = path + ".ActivityDAO";
            return (IActivityDAO)Assembly.Load(path).CreateInstance(className);
        }

        public static IAnnouncementDAO CreateAnnouncementDAO()
        {
            string className = path + ".AnnouncementDAO";
            return (IAnnouncementDAO)Assembly.Load(path).CreateInstance(className);
        }

        public static IRechargeDAO CreateRechargeDAO()
        {
            string className = path + ".RechargeDAO";
            return (IRechargeDAO)Assembly.Load(path).CreateInstance(className);
        }

        public static IRoleDAO CreateRoleDAO()
        {
            string className = path + ".RoleDAO";
            return (IRoleDAO)Assembly.Load(path).CreateInstance(className);
        }

        public static IUsersDAO CreateUsersDAO()
        {
            string className = path + ".UsersDAO";
            return (IUsersDAO)Assembly.Load(path).CreateInstance(className);
        }

        public static IUsersOfActivityDAO CreateUsersOfActivityDAO()
        {
            string className = path + ".UsersOfActivityDAO";
            return (IUsersOfActivityDAO)Assembly.Load(path).CreateInstance(className);
        }

        public static IUsersOfRoleDAO CreateUsersOfRoleDAO()
        {
            string className = path + ".UsersOfRoleDAO";
            return (IUsersOfRoleDAO)Assembly.Load(path).CreateInstance(className);
        }
    }
}
